package model;

import com.sun.javafx.collections.MappingChange;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * Created by yangxianming on 2015-10-27.
 */
public  class TestIdModel implements TestIdModelImpl {
    private Map<String, String> testIdList = new HashMap();

    public void showThisMap(){
        Date date = new Date();
        System.out.println("[" + date + "]-- show test id --");
        for (Map.Entry<String, String> entry :testIdList.entrySet()){
            System.out.println("k:" + entry.getKey() + " v:" + entry.getValue());
        }
    }

    public void clearThisMap(){
        testIdList.clear();
        System.out.println("--test id all clear--");
    }


    @Override
    public boolean addTestId(String id) {
        if (testIdList.containsKey(id))
            return false;
        testIdList.put(id, "1");
        return true;
    }

    @Override
    public boolean deleteTestId(String id) {
        testIdList.remove(id);
        return true;
    }

    @Override
    public boolean isHaveTestId(String id) {
        if (testIdList.containsKey(id))
            return true;
        return false;
    }
}
